﻿<?php
	require 'config.php';
	require 'aes-lib.php';
	
	$uid = $_GET['uid'];	
	$link = mysql_connect($DBServer, $DBUser, $DBPassword);
	mysql_select_db($DBName, $link);		
	mysql_query("SET NAMES 'utf8';", $link);
	mysql_query("SET CHARACTER SET 'utf8';", $link);
	mysql_query("SET SESSION collation_connection = 'utf8_general_ci';", $link);
	
	$query = "SELECT * FROM users WHERE uid = '$uid' LIMIT 1";	
	$results = mysql_query($query);	
	
	$XMLResult = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
	$XMLResult = $XMLResult . "<players>\n";	
	while($line = mysql_fetch_assoc($results)) 
	{	
		$uid = " uid="."\"".$line['uid']."\"";
		$name = " name="."\"".$line['name']."\"";
		$money = " money="."\"".$line['money']."\"";
		$rating = " rating="."\"".$line['rating']."\"";
		$items = " items="."\"".$line['items']."\"";
		$settings = " settings="."\"".$line['settings']."\"";		

		$XMLResult = $XMLResult . "<player". $uid . $name . $money. $rating . $items . $settings . "/>\n";
	}	
	$XMLResult = $XMLResult . "</players>";	
	
	$Encrypted = AESEncryptCtr(base64_encode($XMLResult), $AESKey, 256);	
	echo $Encrypted;
	
	mysql_close($link);	
?>